<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript">
		//[object objtec]
		var arr=[{
			name:'b',
			age:20,
			sarlary:1000
		},{
			name:'a',
			age:23,
			sarlary:1500
		},{
			name:'d',
			age:12,
			sarlary:1800
		},{
			name:"c",
			age:30,
			sarlary:500
		}];
		var result=arr.sort(handler("sarlary"));
		function handler(key){
			return function(a,b){
				//a->{}
				//key->age
				var c=a[key];
				var d=b[key];
				if(c>d){
					return 1
				}else{
					return -1
				}

			}
		}
		console.log(result);





		/*var arr=[1,2,21,11,3];
		arr.sort(function(a,b){
			if(a>b){
				return 1
			}
		});*/











		var length=10;
		function say(){
				var length=20;
				console.log(this.length);
		}
		var obj={
			length:30,
			say:say
		}
		function getSay(){
			arguments[0]();
		
		}
		//getSay(say,say);

		var arr=[say,say,say];

		//arr[2]();
















	</script>
</head>
<body>
	
</body>
</html>